package com.wps.wdztv6.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.io.File;

@Configuration
public class WdztAppinfoProperties {

    /**
     * wdztapp.ak=test03
     * wdztapp.sk=iP0De1k5g45Trncb1fa3J57LQ48x6BSa
     * wdztapp.version=WPS-4
     * wdztapp.host=http://10.138.25.30/open
     */


    public static String ak;
    public static String sk;
    public static String version;
    public static String host;
    //附件的基础路径
    public static String filePath;
    /**
     * wps构建新文件的模板保存位置
     */
    public static String templateFilePath;

    /**
     * wps生成的新文件保存位置
     */
    public static String uploadPath;


    @Value("${wdztapp.ak}")
    public void setAk(String ak) {
        WdztAppinfoProperties.ak = ak;
    }

    @Value("${wdztapp.sk}")
    public void setSk(String sk) {
        WdztAppinfoProperties.sk = sk;
    }

    @Value("${wdztapp.version}")
    public void setVersion(String version) {
        WdztAppinfoProperties.version = version;
    }

    @Value("${wdztapp.host}")
    public void setHost(String host) {
        WdztAppinfoProperties.host = host;
    }

    @Value("${wdztapp.filePath}")
    public void setFilePath(String filePath) {
        WdztAppinfoProperties.filePath = filePath;
    }


    @Value("${wdztapp.templateFilePath}")
    public void setTemplateFilePath(String templateFilePath) {
        WdztAppinfoProperties.templateFilePath = templateFilePath;
    }

    public static String templateFilePath() {
        File templateFilePathFolder = new File(WdztAppinfoProperties.templateFilePath);
        return templateFilePathFolder.getAbsolutePath() + File.separator;
    }

    @Value("${wdztapp.savePath}")
    public void setUploadPath(String uploadPath) {
        WdztAppinfoProperties.uploadPath = uploadPath;
    }

    public static String uploadPath() {
        File templateFilePathFolder = new File(WdztAppinfoProperties.uploadPath);
        return templateFilePathFolder.getAbsolutePath() + File.separator;
    }
}
